package ru.cod.rs.main.managers;

import android.graphics.Canvas;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class DrawManager extends CyclicManager {

	private SurfaceHolder holder;
	protected SurfaceView view;

	public DrawManager(SurfaceView v) {
		view = v;
		holder = view.getHolder();
	}

	@Override
	public void execute() {
		Canvas canvas = null;
		try {
			canvas = holder.lockCanvas();
			synchronized (holder) {
				draw(canvas);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (canvas != null) {
				holder.unlockCanvasAndPost(canvas);
			}
		}
	}

	protected void draw(Canvas canvas) {

	}
}
